/**

 * @File RollUpGroupDaoImpl.java
 * @author Dhruv Bhandari
 * @Version 1.0
 * @Date June 27, 2013
 * 
 * Copyright (c) 2011 EdRP, Dayalbagh Educational Institute.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or
 * without modification, are permitted provided that the following
 * conditions are met:
 *
 * Redistributions of source code must retain the above copyright
 * notice, this  list of conditions and the following disclaimer.
 *
 * Redistribution in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in
 * the documentation and/or other materials provided with the
 * distribution.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL ETRG OR ITS CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Contributors: Members of EdRP, Dayalbagh Educational Institute
 */




package in.ac.dei.edrp.generalLedger.rollUpGroup;

import java.util.List;

import in.ac.dei.edrp.generalLedger.rollUpGroup.RollUpGroupBean;
import in.ac.dei.edrp.generalLedger.rollUpGroup.RollUpGroupDaoImpl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;

import com.ibatis.sqlmap.client.SqlMapClient;
@Component
@Qualifier("RollUpGroupDaoImpl")
public class RollUpGroupDaoImpl extends SqlMapClientDaoSupport implements RollUpGroupDao 
{	
private static Logger logObj = Logger.getLogger(RollUpGroupDaoImpl.class);
	
RollUpGroupDaoImpl(){}	
	
@Autowired
	public RollUpGroupDaoImpl(SqlMapClient sqlMapClient)
	   {
		    setSqlMapClient(sqlMapClient);
	   }
	


					public List<RollUpGroupBean> getAllRollUpGroup(RollUpGroupBean bean) 
					{
					
					List<RollUpGroupBean> list = null;
					      try{
						            
					    	   list = getSqlMapClientTemplate().queryForList("rollUpGroupSqlMap.getAllRollUpGroup", bean);
						     }
					         catch(Exception e)
					              {
						              logObj.error("Error inside getAllRollUpGroup method of RollUpGroupDaoImpl Class: ", e);
				             	  } 
						return list;
					}
	 
					public String setRollUpGroup(RollUpGroupBean bean, String flag) 
					{
						
						String status = "" ;
						 try{
							
						 if (flag.equalsIgnoreCase("N"))
						 {
					         getSqlMapClient().insert("rollUpGroupSqlMap.setRollUpGroup", bean);
					         status = "insert";
						 }   
					         else
					     {
					         getSqlMapClient().update("rollUpGroupSqlMap.updateRollUpGroup", bean);
					         status = "update";
					     }
					 }    catch(Exception ex)
				         {
				           status="Exception";
				           logObj.info("Exception in setRollUpGroup method");
				           logObj.error(ex.getClass());
				           status = ex.getClass().toString();
				          
				           }
					 return status;
						
						
					}
	
	
	
					public String deleteRollUpGroup(RollUpGroupBean bean) {
							
							String status = "" ;
							 try{
						         getSqlMapClient().delete("rollUpGroupSqlMap.deleteRollUpGroup", bean);
						         status = "delete";
							 }catch(Exception ex)
					         { 
					           status="Exception";
					           logObj.info("Exception in deleteRollUpGroup method");
					           logObj.error(ex.getClass());
					          
					          
					           }
						 return status;
							
							
						}

					 public List<RollUpGroupBean> setSegmentCode(RollUpGroupBean bean)
					 {
						 List<RollUpGroupBean> list = null;
					     try{
						            
					   	   list = getSqlMapClientTemplate().queryForList("rollUpGroupSqlMap.setSegmentCode", bean);
					   	   
					   	  
						     }
					        catch(Exception e)
					             {
						              logObj.error("Error inside setSegmentCode method of RollUpGroupDaoImpl Class: ", e);
						              System.out.println("error");
					        	  } 
						return list;
						 
						 
					 }
					 
 
				 public List<RollUpGroupBean> getFlexFieldName(RollUpGroupBean bean)
				 {
					 List<RollUpGroupBean> list = null;
				     try{
					            
				   	   list = getSqlMapClientTemplate().queryForList("rollUpGroupSqlMap.getFlexFieldName", bean);
				   	   
				   	  
					     }
				        catch(Exception e)
				             {
					              logObj.error("Error inside getFlexFieldName method of RollUpGroupDaoImpl Class: ", e);
					              System.out.println("error");
				        	  } 
					return list;
		 
		 
				 	}
				 
			 
			 
					 public List<RollUpGroupBean> getFlexFieldCode(RollUpGroupBean bean)
					 {
						 List<RollUpGroupBean> list = null;
					     try{
						            
					   	   list = getSqlMapClientTemplate().queryForList("rollUpGroupSqlMap.getFlexFieldCode", bean);
					   	   
					   	  
						     }
					        catch(Exception e)
					             {
						              logObj.error("Error inside getFlexFieldCode method of RollUpGroupDaoImpl Class: ", e);
						              System.out.println("error");
					        	  } 
						return list;
					 }

 
					 public String updateRollUpGroup(RollUpGroupBean bean, String flag) 
					 {
							
							String status = "" ;
							 try{
								
							 
						         getSqlMapClient().update("rollUpGroupSqlMap.updateRollUpGroup", bean);
						         status = "update";
							 }catch(Exception ex)
					      {
					        status="Exception";
					        logObj.info("Exception in updateRollUpGroup method");
					        logObj.error(ex);
					       
					        }
						 return status;
						
					}
					 public List<RollUpGroupBean> getSegmentValue(RollUpGroupBean bean)
					 {
						 List<RollUpGroupBean> list = null;
					     try{
						            
					   	   list = getSqlMapClientTemplate().queryForList("rollUpGroupSqlMap.getSegmentValue", bean);
					   	   
					   	  
						     }
					        catch(Exception e)
					             {
						              logObj.error("Error inside getSegmentValue method of RollUpGroupDaoImpl Class: ", e);
						              System.out.println("error");
					        	  } 
						return list;
						 
						 
					 }
 
}


